package com.chenliwu.demo.base;

/**
 * @author chenliwu
 * @since 2022-01-09
 */
public class NaNCompareDemo {
    public static void main(String[] args) {
        double num = 0.0d;
        double result = Math.cos(1 / num);  // 如果输入是infinity则返回NaN
        if (result == Double.NaN) {
            // 相等比较总是false
            System.out.println("result is NaN");
        }
    }
}
